import config from '@/common/config'
export const api = {
	login: '/sys/user/login',
	logout: '/api/member/loginout', //退出登录
	upload: config.baseUrl + '/api/upload/uploader', //上传图片
	getUserInfo: '/api/member/userinfo',
	updateUserInfo: '/api/member/update',
	getsysInfo: '/api/system/info', //获取设置
	shareInfo: '/api/system/share', //获取分享信息
	dengji: '/api/member/product/dengji',
	productScreen: 'api/member/product/product_screen', //产品筛选条件
	getkf: '/api/system/get_city_kf', //获取客服
	/* 登录 */
	getSms: '/api/sms/',
	login: '/api/member/login',
	getOpenid: '/api/member/session_key/', //获取openid
	decrypt: '/api/member/decrypt',
	/* *****公共接口****** */
	getArticleList: '/api/system/article/', //获取文章列表
	getArticleDetail: '/api/system/article/', //获取文章详情
	getProductList: '/api/member/product/', //获取产品
	getProductEvaluate: '/api/member/product/evaluate/', //获取商品评价
	getProductImg: '/api/system/product/images', //获取产品固定简介图片
	getCateList: '/api/member/product/class', //产品分类获取
	addFollow: '/api/member/follow/add/product/', //添加产品关注
	delFollow: '/api/member/follow/delete/product/', //取消关注 产品页
	priceLine: '/api/member/product/amount/log/', //价格曲线图
	/* 首页接口 */
	getAdList: '/api/system/ad',
	getHomesupplier: '/api/member/supplier_top', //首页推荐供应商
	todayQty: '/api/system/today/qty', //今日销量
	notice: '/api/system/notice',
	/* 交易大厅 */
	getProductTypeList: '/api/member/product/index', //大产品分类
	getColorList: '/api/member/product/color', //获取产品颜色列表
	/* 筛选 */
	searchRecord: '/api/search', //搜索记录
	delSearchRecord: '/api/search/delete', //删除搜索记录
	/* 供应商 */
	getSupplierInfo: '/api/member/supplier/', //获取商品信息
	delSupplierFollow: '/api/member/follow/delete/supplier/', //店铺关注取消（店铺界面）
	addSupplierFollow: '/api/member/follow/add/supplier/', //店铺关注添加
	/* 购物车 */
	getCarList: '/api/member/cart/index/',
	getCarCount: '/api/member/cart/cart_number',
	inputCar: '/api/member/cart/setout/',
	deleteCar: '/api/member/cart/delete',
	addcar: '/api/member/cart/increase/', //添加购物车
	getTransport: '/api/member/transport', //获取运输方式
	/* 我的关注 */
	productFollowList: '/api/member/follow/product', //产品关注列表
	shopFollowList: '/api/member/follow/supplier', //店铺关注列表
	delFollowbylist: '/api/member/follow/delete/', //取消关注 关注页
	delSupplierFollow: '/api/member/follow/delete/supplier/', //店铺关注取消（店铺界面）
	addSupplierFollow: '/api/member/follow/add/supplier/', //店铺关注添加
	/* 地址 */
	getaddrList: 'api/member/address/index',
	getAddrInfo: '/api/member/address/show/',
	addAddr: '/api/member/address/add', //新增用户地址
	setdefaultAddr: '/api/member/address/default/', //设置默认地址
	editAddr: '/api/member/address/edit/', //编辑用户地址
	delAddr: '/api/member/address/delete/', //删除用户地址
	getDefaultAddr: '/api/member/address/get/default', //获取默认地址
	/* 优惠券 */
	getMyCouponList: '/api/member/coupon',
	getCouponList: '/api/member/coupon/list', //可兑换的优惠券
	getCoupon: 'api/member/coupon/receive/', //兑换
	/* 订单 */
	calcOrder: '/api/member/order/calc',
	submitOrder: '/api/member/order/submit',
	// orderPay: '/api/member/order/pay_v2/', //分账 订单列表中确认支付,
	orderPay: '/api/member/order/pay_v', //分账 订单列表中确认支付,
	buttonPay: '/api/member/order/pay/', //确认支付,
	orderClose: '/api/member/order/close/', //订单取消
	orderShow: '/api/member/order/show/', //订单查看
	orderDelete: '/api/member/order/delete/', //订单删除
	orderAftersale: '/api/member/order/aftersale/', //待收货订单内产品申请售后
	orderEvaluate: '/api/member/order/evaluate/', //提交订单评价
	orderConfirm: '/api/member/order/confirm/', //确认收货
	getOrderlist: '/api/member/order/index',
	getAftersaleList: '/api/member/order/showaftersale', //售后订单列表
	getEvaluateList: '/api/member/order/showevaluate', //评价订单列表
	logistics: '/api/member/order/kd/', // 物流信息查询接口
	getAftersaleList: '/api/member/order/showaftersale', //售后订单列表
	/* 意见反馈 */
	feedback: 'api/member/feedback',
	/* 钱包 */
	getScoreList: '/api/member/score',
	getBillList: 'api/member/money/more',
	tixian: '/api/member/tixian', //提现
	/* 会员 */
	getVipType: '/api/member/vip/index',
	createVip: '/api/member/vip/create',
	getGreencardPrice: '/api/member/greencard/index', //获取绿卡会员价格
	Opengreencard: '/api/member/greencard/create', //开通绿卡

	getfreshbean: '/api/member/freshbean/more', //会员鲜豆明细
	exchangeMoney: '/api/member/freshbean/exchange', //鲜豆兑换余额
	tixian: '/api/member/tixian', //用户提现申请

	updatePayment: '/api/member/payment/update', //更新银行卡
	getPayment: '/api/member/payment/index', //获取银行卡
	getActivelist: '/api/system/active/index', //获取活动列表
	getActiveState: '/api/system/active/page/', //获取活动状态
	getActiveInfo: '/api/system/active/page/',
	getActiveCate: 'api/system/active/class', //获取活动分类
	getQrcode: '/api/member/create/code',

	/* 管理端接口 */
	getShopOrderList: '/api/member/hhr/orders/index', //查询管理端接口
	getShopOrderDetails: '/api/member/hhr/orders/show/', //订单详情
	psOder: '/api/member/hhr/orders/ps/', //确认配送或者取消配送

	/* 定位 */
	get_city: 'api/system/get_city', //获取城市信息
	get_address: 'api/system/get_address', //转换城市信息

	getquickProduct: '/api/member/quick/product', //查询快速下单商品
	addquickProduct: '/api/member/quick/join_product_purchase', //添加查询快速下单商品
	getPurchaseList: '/api/member/quick/purchase_list',
	delquickProduct: '/api/member/quick/del_product_purchase/',
	getquickTemplate: '/api/member/quick/template/index',
	saveTmp: '/api/member/quick/template/save',
	delTmp: '/api/member/quick/template/del/',
	importTmp: '/api/member/quick/template/import/',
	addShopcart: '/api/member/quick/shopcart',
	delAllquickProduct: '/api/member/quick/delall',
	//待支付
	behalforderShow: '/api/member/order/v2/show/', //代购订单详情
	get_wxminprogram: '/api/system/get_wxminprogram', //获取小程序配置相关信息
	getInvoicesOrders: '/api/member/invoices/get/orders', //获取可开具的发票订单
	addInvoices: '/api/member/invoices/create', //创建发票
	invoicesList: 'api/member/invoices/show', //获取发票记录

	getWithdrawalList: '/api/member/tixian/confirm', //提现明细
	updateWithdrawal: '/api/member/tixian/confirm/update/', //更新提现信息
}



// test get api
export function getAction(url, params, config = {}) {
	return uni.$u.http.get(url, {
		...params,
		...config
	})
}

// test post api
export function postAction(url, params, config = {}) {
	return uni.$u.http.post(url, params, config)
}
export function setToken(refreshToken) {
	return postAction(api.refreshToken, refreshToken)
}
export function logout() {
	return uni.$u.http.post(api.logout)
}
export function getUserInfo() {
	return uni.$u.http.post(api.getUserInfo, null, {
		custom: {
			ShowLoading: false
		}
	})
}
export function getCarCount() {
	return uni.$u.http.post(api.getCarCount, null, {
		custom: {
			ShowLoading: false
		}
	})
}
//获取客服信息
export function getkf() {
	return uni.$u.http.post(api.getkf);
}